﻿
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using Digitalmes.Model.EquipmentManagement;
using Digitalmes.Model;

namespace Digitalmes.ViewModel.EquipmentManagement.MaintenanceRecordVMs
{
    public partial class MaintenanceRecordTemplateVM : BaseTemplateVM
    {
        
        [Display(Name = "_Model._MaintenanceRecord._Plan")]
        public ExcelPropety Plan_Excel = ExcelPropety.CreateProperty<MaintenanceRecord>(x => x.PlanId);
        [Display(Name = "_Model._MaintenanceRecord._Equipment")]
        public ExcelPropety Equipment_Excel = ExcelPropety.CreateProperty<MaintenanceRecord>(x => x.EquipmentId);
        [Display(Name = "_Model._MaintenanceRecord._Maintainer")]
        public ExcelPropety Maintainer_Excel = ExcelPropety.CreateProperty<MaintenanceRecord>(x => x.MaintainerId);
        [Display(Name = "_Model._MaintenanceRecord._MaintenanceTime")]
        public ExcelPropety MaintenanceTime_Excel = ExcelPropety.CreateProperty<MaintenanceRecord>(x => x.MaintenanceTime, true);
        [Display(Name = "_Model._MaintenanceRecord._FinishTime")]
        public ExcelPropety FinishTime_Excel = ExcelPropety.CreateProperty<MaintenanceRecord>(x => x.FinishTime, true);
        [Display(Name = "_Model._MaintenanceRecord._ActualHours")]
        public ExcelPropety ActualHours_Excel = ExcelPropety.CreateProperty<MaintenanceRecord>(x => x.ActualHours);
        [Display(Name = "_Model._MaintenanceRecord._Result")]
        public ExcelPropety Result_Excel = ExcelPropety.CreateProperty<MaintenanceRecord>(x => x.Result);
        [Display(Name = "_Model._MaintenanceRecord._Note")]
        public ExcelPropety Note_Excel = ExcelPropety.CreateProperty<MaintenanceRecord>(x => x.Note);
        [Display(Name = "_Model._MaintenanceRecord._CreateTime")]
        public ExcelPropety CreateTime_Excel = ExcelPropety.CreateProperty<MaintenanceRecord>(x => x.CreateTime, true);
        [Display(Name = "_Model._MaintenanceRecord._UpdateTime")]
        public ExcelPropety UpdateTime_Excel = ExcelPropety.CreateProperty<MaintenanceRecord>(x => x.UpdateTime, true);
        [Display(Name = "_Model._MaintenanceRecord._CreateBy")]
        public ExcelPropety CreateBy_Excel = ExcelPropety.CreateProperty<MaintenanceRecord>(x => x.CreateBy);
        [Display(Name = "_Model._MaintenanceRecord._UpdateBy")]
        public ExcelPropety UpdateBy_Excel = ExcelPropety.CreateProperty<MaintenanceRecord>(x => x.UpdateBy);
        [Display(Name = "_Model._MaintenanceRecord._IsValid")]
        public ExcelPropety IsValid_Excel = ExcelPropety.CreateProperty<MaintenanceRecord>(x => x.IsValid);
        [Display(Name = "_Model._MaintenanceRecord._TenantCode")]
        public ExcelPropety TenantCode_Excel = ExcelPropety.CreateProperty<MaintenanceRecord>(x => x.TenantCode);

	    protected override void InitVM()
        {
            
            Plan_Excel.DataType = ColumnDataType.ComboBox;
            Plan_Excel.ListItems = DC.Set<MaintenancePlan>().GetSelectListItems(Wtm, y => y.TenantCode.ToString());
            Equipment_Excel.DataType = ColumnDataType.ComboBox;
            Equipment_Excel.ListItems = DC.Set<Equipment>().GetSelectListItems(Wtm, y => y.ID.ToString().ToString());

        }

    }

    public class MaintenanceRecordImportVM : BaseImportVM<MaintenanceRecordTemplateVM, MaintenanceRecord>
    {
            //import

    }

}